//
//  YZMRedPacketListModel.m
//  YZMicroStock
//
//  Created by apple on 17/5/10.
//  Copyright © 2017年 cqjr. All rights reserved.
//

#import "YZMRedPacketListModel.h"
#import "Mantle+Utils.h"
#import "NSNumber+Utils.h"

@implementation YZMRedPacketFundDetailModel

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{
             @"pageIndex": @"pageIndex",
             @"totalPage": @"totalPage",
             @"items":@"items",
             };
}

+ (NSValueTransformer *)itemsJSONTransformer
{
    return [MTLJSONAdapter arrayTransformerWithModelClass: [YZMRedPacketListModel class]];
}

- (void)setNilValueForKey:(NSString *)key {
    
}

@end

@implementation YZMRedPacketListModel


+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    
    return @{
             @"money": @"money",
             @"time": @"time",
             @"title": @"title",
             @"type": @"type"
             };
}

+ (NSValueTransformer *)timeJSONTransformer {
    
    return [NSValueTransformer valueTransformerForName: MTLDoubleDateTransformerName];
}

- (void)setNilValueForKey:(NSString *)key {
    
}
- (NSString *)tradeDescription {
    
    if ([self.title isEqualToString:@"ZCHB"]) {
        
        return @"新用户注册送红包";
    }else if([self.title isEqualToString:@"HBBF"]){
     
        return @"红包补发";
    }else if ([self.title isEqualToString:@"MFTYHB"]){
        return @"免费体验红包";
    }else if ([self.title isEqualToString:@"SCCZ"]) {
        
        return @"首次充值红包";
    } else if ([self.title isEqualToString:@"SMRZ"]) {
        
        return @"完成实名认证送红包";
    } else if ([self.title isEqualToString:@"MNJY"]) {
        
        return @"完成模拟交易5次送红包";
    } else if ([self.title isEqualToString:@"SPJY"]) {
        
        return @"实盘交易送红包";
    } else if ([self.title isEqualToString:@"JYZHF"]) {
        
        if (self.type == 1) {
            
            return @"实盘交易综合费返还";
        } else {
            
            return @"实盘交易综合费抵扣";
        }
    }
    
    return nil;
}

- (NSString *)showPrice {
    
    if (self.type == 1) {
        
        return [NSString stringWithFormat:@"+%@元", @(self.money).p02fString];
    } else if (self.type == 2) {
        
        return [NSString stringWithFormat:@"-%@元", @(self.money).p02fString];
    }
    
    return nil;
}

@end
